//
//  UIButton+ClickAction.m
//  QXShowing
//
//  Created by 王道道 on 2018/5/14.
//  Copyright © 2018年 doll_dream. All rights reserved.
//

#import "UIButton+ClickAction.h"

@implementation UIButton (ClickAction)


//- (void)callAction:(NSString *)phone withAlertTitle:(NSString *)titleStr{
//    if ([BHSettingUtil dataAndStringIsNull:titleStr]) {
//        titleStr = @"是否需要拨打客服？";
//    }
//    CustomAlertView *backAlertView = [[CustomAlertView alloc]initWithTitle:@"温馨提示" message:titleStr viewType:CustomAlertViewTypeNonePrompting delegate:self cancelButtonTitle:@"不需要" otherButtonTitles:@"确认"];
//    [backAlertView presentContentView:self.view animated:NO];
//}

- (void)callAction:(NSString *)phone {
    NSMutableString * phoneStr=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",phone];
    NSURL *phoneUrl = [NSURL URLWithString:phoneStr];
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
        if ([[UIApplication sharedApplication] openURL:phoneUrl]) {
            [[UIApplication sharedApplication] openURL:phoneUrl];
        }
        else {
            [[BHAlertUtil alertManager] showPromptInfo:@"拨打电话失败"];
        }
    });
}

//#pragma mark - HomePageProtocol
//- (void)homeColumnView:(UIView *)columnView didSelect:(NSInteger)row {
//    if (row == 1) {
//        [self callAction:];
//    }
//    else {
//        [[BHAlertUtil alertManager] showPromptInfo:@"取消拨打电话"];
//    }
//}

@end
